﻿@model Kooboo.CMS.Sites.Models.HtmlBlock
@{
    ViewBag.Title = "Edit html block".Localize();
    Layout = "~/Views/Shared/Blank.cshtml";
}
@section Panel{
    <ul class="panel">
        <li>
            <a data-ajaxform="">
                @Html.IconImage("save") @("Save".Localize())</a>
        </li>
        @foreach (var group in Kooboo.CMS.Sites.Extension.UI.TopToolbar.ToolbarButtons.GetToolbarButtons(ViewContext.RequestContext))
        {
            @Html.Partial("_ToolbarGroupButtons", group)
        }
        <li>
            <a href="@ViewContext.RequestContext.GetRequestValue("return")">
                @Html.IconImage("cancel") @("Back".Localize())</a>
        </li>
    </ul>
}

<div class="block common-form">
    <h1 class="title">@ViewBag.Title</h1>

    @using (Html.BeginForm())
    { 
        @Html.Hidden("SiteName", ViewContext.RequestContext.GetRequestValue("SiteName")) 
        <input type="hidden" name="Name" value="@Model.Name" />
        <input type="hidden" name="old_Key" value="@Model.Name" />
        @Html.ValidationSummary(true) 
        <table>
            <tbody>
                @Html.DisplayFor(m => m.Name, new { HtmlAttributes = new { @class = "medium" } })
                @Html.EditorFor(m => m.Body)
            </tbody>
        </table>
    }

    @if (ViewBag.ExternalCssSetting != null)
    {
        <script type="text/javascript">
            (function () {
                var old = tinymce.getKoobooConfig;
                tinymce.getKoobooConfig = function () {
                    var ret = old.apply(this, arguments);
                    ret.content_css = '@Html.Raw(ViewBag.ExternalCssSetting)';
                    return ret;
                };
            }());
        </script>
    }

</div>
